package com.woniu.communitymanagement.controller;

import com.woniu.communitymanagement.entity.HttpResult;
import com.woniu.communitymanagement.entity.Repair;
import com.woniu.communitymanagement.service.RepairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/repair")
@CrossOrigin(origins = "*")
public class RepairController {

    @Autowired
    private RepairService repairService;
    @RequestMapping("/delete")
    public HttpResult deleteById(int id){
        return repairService.deleteRepairById(id);
    }
    @RequestMapping("/update")
    public HttpResult updateById(int id){
        return repairService.updateRepairById(id);
    }

    @RequestMapping("/refresh")
    public HttpResult refreshById(int id){
        return repairService.refreshRepairById(id);
    }
    @PostMapping("/insert")
    public HttpResult insertOwner(@RequestBody Repair repair){
        return repairService.insertRepair(repair);
    }
    @RequestMapping("/list")
    public HttpResult List(int pageIndex,int pageSize,String comId,String status){
        return repairService.selectRepairAll(comId,status,pageIndex,pageSize);
    }
    @RequestMapping("/info")
    public HttpResult selectOne(int id){
        return repairService.selectRepairById(id);
    }

    @RequestMapping("/rtlist")
    public HttpResult repairTypeList(){
        return repairService.selectRepairTypeAll();
    }

    @RequestMapping("/ownerlist")
    public HttpResult ownerTypeList(){
        return repairService.selectOwnerAll();
    }


}
